*-----------------------------------------------------------------------------------------------------------------*
* 	Table 7: If agree with the Statement: "The average repayment rate of women is higher than that of men"        *
*-----------------------------------------------------------------------------------------------------------------*
{
cd "$data"
use ExperimentalData_Officers_NonAttrit, clear

***** Bootstrapped standard errors are shown in parentheses

sort auxvar

local off_female off_female
local regionbankfe d_region_bank_fe1-d_region_bank_fe61
local execcovariates off_higher_educ off_exp_6_or_less off_exp_7_to_12 

capture foreach outcome of varlist agree_with_salience {

			*all
			regress `outcome' treat  `off_female' `regionbankfe' `execcovariates', vce(boot, rep(3000) seed(1010101))
			sum `outcome' if treat==0
			local mean_cont = r(mean)
			outreg2 treat using "${tables}/Table7_bse.xls", keep(treat) addstat("mean_cont", `mean_cont') adec(3) excel `append' bdec(3) sdec(3) stats(coef se) auto(3) alpha(.01, .05, .10) symbol(***,**,*) br
            local append "append" 
			*misaligned
			regress `outcome' treat  `off_female' `regionbankfe' `execcovariates' if mis_with_treat_message==1, vce(boot, rep(3000) seed(1010101))
			sum `outcome' if treat==0 & mis_with_treat_message==1
			local mean_cont = r(mean)
			outreg2 treat using "${tables}/Table7_bse.xls", keep(treat) addstat("mean_cont", `mean_cont') adec(3) excel `append' bdec(3) sdec(3) stats(coef se) auto(3) alpha(.01, .05, .10) symbol(***,**,*) br
            local append "append" 
			*not misaligned
			regress `outcome' treat  `off_female' `regionbankfe' `execcovariates' if mis_with_treat_message==0, vce(boot, rep(3000) seed(1010101))
			sum `outcome' if treat==0 & mis_with_treat_message==0
			local mean_cont = r(mean)
			outreg2 treat using "${tables}/Table7_bse.xls", keep(treat) addstat("mean_cont", `mean_cont') adec(3) excel `append' bdec(3) sdec(3) stats(coef se) auto(3) alpha(.01, .05, .10) symbol(***,**,*) br
            local append "append" 
			*Warning: insufficient observations to compute bootstrap standard errors in column 3....we thus proceed through 		Frisch-Waugh (see below)

}


*Bootstrapped standard errors are shown in parentheses (frisch-waugh)

*Column 3

sort auxvar

*partialling out agree_with_salience for treat
reg agree_with_salience `off_female' `regionbankfe' `execcovariates' if mis_with_treat_message==0
predict tilda_outcome3, res

*partialling out treat
reg treat `off_female' `regionbankfe' `execcovariates' if mis_with_treat_message==0
predict tilda_treat3, res

*frisch-waugh 
reg tilda_outcome3 tilda_treat3 if mis_with_treat_message==0, vce(boot, rep(3000) seed(1010101)) 

*control mean column 3
sum agree_with_salience if treat==0 & mis_with_treat_message==0

			
*Multiple Hypotheses Testing: MHT p-val. follows List et al. (2021), Theorem 3.1., to report the multiplicity adjusted p-value for multiple hypothesis testing (3,000 reps.) of H0: \beta_Treat = 0 across subgroups of analysis, controlling for the specified covariates (3,000 reps).

sort auxvar

local off_female off_female
local regionbankfe d_region_bank_fe1-d_region_bank_fe61
local execcovariates off_higher_educ off_exp_6_or_less off_exp_7_to_12 

*(1), (2), (3) MHT p-v. (bt)

 mhtreg (agree_with_salience treat  `off_female' `regionbankfe' `execcovariates') ///
        (agree_with_salience treat  `off_female' `regionbankfe' `execcovariates' if mis_with_treat_message==1) ///
	    (agree_with_salience treat  `off_female' `regionbankfe' `execcovariates' if mis_with_treat_message==0), /// 
	   seed(1010101010) bootstrap(3000)

	   
}
	

